package com.amit.Basic_Simple_Program;

import java.util.Scanner;

public class Insert_Element_Array 
{
	public static void main(String[] args)
	{
     int a[],value,position;
     
     System.out.println("Please enter a number for element of array");
     Scanner sc=new Scanner(System.in);
     
     int n=sc.nextInt();
     a=new int[n];
     
     System.out.println("Enter the element for array");
     for(int i=0;i<=a.length-1;i++)
     {
    	 a[i]=sc.nextInt();
     }
     
     System.out.println("Enter the position for inserting element");
      position=sc.nextInt();
      
      System.out.println("Enter the element for insertion");
       value=sc.nextInt();
       
       for(int c=a.length-1;c>=position-1;c--)
       {
    	   a[c+1]=a[c];
    	   a[position-1]=value;
       }
       
       System.out.println("Resultant array");
       for(int c=0;c<=a.length-1;c++)
       {
    	   System.out.println(a[c]);
       }
		
	}

}
